<template>
	<view id="readfile"></view>
</template>

<script>
	import config from '@/config/api.js'
	export default {
		data() {
			return {

			}
		},
		mounted() {
			uni.setNavigationBarTitle({
				title: "工匠租-租赁合同签署",
			});
			this.loadFile()
		},
		methods: {
			loadFile() {
				const _this = this
				const script = document.createElement('script');
				script.src = `${config.h5}/static/js/docx.min.js`;
				script.onload = () => {
					setTimeout(() => {
						_this.renderFile()
					}, 500)
					// 脚本加载完成后，可直接使用 my 对象
				};
				script.onerror = (err) => {
					console.error('docx.min.js 引入失败：', err);
				};
				document.head.appendChild(script);
			},
			renderFile() {
				Docx.docx2HTML(`${config.h5}/static/js/d.docx`).then(docx => {
					docx.toHTML(document.getElementById('readfile'))
				});
			}
		}
	}
</script>

<style>
</style>